<?php


namespace App\Models;


class OrderRefund extends BaseModel
{
    protected $table = 'order_refund';
    CONST REFUND = [
        '0' => '未处理',
        '1' => '已审核',
        '2' => '拒绝退货',
    ];
    public static function getOneByOrderId($order_id)
    {
        $refund = self::where('order_id', $order_id)->first();
        return $refund;
    }

    public function setImgsAttribute($imgs)
    {
        if (is_array($imgs)) {
            $this->attributes['pictures'] = json_encode($imgs);
        }
    }

    public function getImgsAttribute($imgs)
    {
        return json_decode($imgs, true);
    }
}